package com.cqhilink.iot.jobstandardmanagement.services.innerservice.impl.device;

import com.cqhilink.iot.jobstandardmanagement.dao.mapper.DeviceRecordMapper;
import com.cqhilink.iot.jobstandardmanagement.facade.model.DeviceRecord;
import com.cqhilink.iot.jobstandardmanagement.facade.service.device.JsmDeviceRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 设备启停记录实现
 *
 * @author zjh
 * @since 20170503
 */
public class JsmDeviceRecordServiceImpl implements JsmDeviceRecordService {
    @Autowired
    private DeviceRecordMapper deviceRecordMapper;

    /**
     * 新增设备启停记录
     * @param deviceRecord 启停记录
     * @return
     */
    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public int addDeviceRecord(DeviceRecord deviceRecord) {
        return deviceRecordMapper.insert(deviceRecord);
    }


    /**
     * 查询该设备的出库、启用、废弃的时间信息
     *
     * @param deviceRecord
     * @return
     */
    public List<DeviceRecord> selectByDericeId(DeviceRecord deviceRecord) {
        return deviceRecordMapper.selectByDericeId(deviceRecord);
    }
}
